home *** CD-ROM | disk | FTP | other *** search
/ Champak 139 / (Vol 139) Sep 24 2011.iso / Games / kirby.swf / scripts / DefineSprite_162 / frame_1 / PlaceObject2_123_1 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2011-09-24  |  3KB  |  87 lines

  1. onClipEvent(enterFrame){
  2.    if(_root.Level[eval("../:Name")]._x + _root.Level._x >= - RandM && _root.Movwidth + RandM >= _root.Level[eval("../:Name")]._x + _root.Level._x && _root.Level[eval("../:Name")]._y + _root.Level._y >= - RandM && _root.Movheight + RandM >= _root.Level[eval("../:Name")]._y + _root.Level._y && _root.Kirby.AttackDemo == "off" && _root.Level[eval("../:Name")]._visible == 1)
  3.    {
  4.       Y -= 1;
  5.       if(Y < - MaxY)
  6.       {
  7.          Y = - MaxY;
  8.       }
  9.       if(_root.Kirby.Spiting != eval("../:Name"))
  10.       {
  11.          var forvar = 1;
  12.          while(_root.Grounds >= forvar)
  13.          {
  14.             if(this.hit.hitTest(_root.Level["G" add forvar]))
  15.             {
  16.                if(_root.Level["G" add forvar]._y + MaxY >= _root.Level[eval("../:Name")]._y)
  17.                {
  18.                   _root.Level[eval("../:Name")]._y = _root.Level["G" add forvar]._y;
  19.                   Y = 0;
  20.                }
  21.                else
  22.                {
  23.                   X *= -1;
  24.                }
  25.             }
  26.             forvar++;
  27.          }
  28.          var forvar = 1;
  29.          while(_root.Blocks >= forvar)
  30.          {
  31.             if(this.hit.hitTest(_root.Level["B" add forvar]) && _root.Level["B" add forvar]._visible == 1)
  32.             {
  33.                if(_root.Level["B" add forvar]._y + MaxY >= _root.Level[eval("../:Name")]._y)
  34.                {
  35.                   _root.Level[eval("../:Name")]._y = _root.Level["B" add forvar]._y - _root.Level["B" add forvar]._height / 2;
  36.                   Y = 0;
  37.                }
  38.                else
  39.                {
  40.                   X *= -1;
  41.                }
  42.             }
  43.             forvar++;
  44.          }
  45.          _root.Level[eval("../:Name")]._x += X;
  46.          _root.Level[eval("../:Name")]._y -= Y;
  47.       }
  48.       if(0 < X)
  49.       {
  50.          _root.Level[eval("../:Name")]._xscale = -100;
  51.       }
  52.       else
  53.       {
  54.          _root.Level[eval("../:Name")]._xscale = 100;
  55.       }
  56.       if(On != "off2")
  57.       {
  58.          On = "on";
  59.       }
  60.    }
  61.    else
  62.    {
  63.       if(On == "on" && _root.Level[eval("../:Name")]._visible == 0)
  64.       {
  65.          duplicateMovieClip(_root.Level.Puffeffect,"Peffect1",16584);
  66.          _root.Level.Peffect1._x = _root.Level[eval("../:Name")]._x;
  67.          _root.Level.Peffect1._y = _root.Level[eval("../:Name")]._y - 10;
  68.       }
  69.       On = "off";
  70.       if(- RandL >= StartX + _root.Level._x || StartX + _root.Level._x >= _root.Movwidth + RandL || - RandL >= StartY + _root.Level._y || StartY + _root.Level._y >= _root.Movheight + RandL)
  71.       {
  72.          _root.Level[eval("../:Name")]._visible = 1;
  73.          _root.Level[eval("../:Name")]._x = StartX;
  74.          _root.Level[eval("../:Name")]._xscale = StartXscale;
  75.          _root.Level[eval("../:Name")]._y = StartY;
  76.          if(0 < StartXscale)
  77.          {
  78.             X = - Speed;
  79.          }
  80.          else
  81.          {
  82.             X = Speed;
  83.          }
  84.       }
  85.    }
  86. }
  87.